﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Renci.iRods.Common;

namespace Renci.iRods.Packets
{
    //#define simpleQueryInp_PI "str *sql; str *arg1; str *arg2; str *arg3; str *arg4; int control; int form; int maxBufSize;"
    [Packet("simpleQueryInp_PI")]
    internal class SimpleQueryInputPacket : Packet
    {
        public SimpleQueryInputPacket(int form, int maxBufferSize, string sqlText, string[] arguments)
        {
            this.Form = form;
            this.MaximumBufferSize = maxBufferSize;
            this.SqlText = sqlText;

            if (arguments.Length > 0)
                this.Argument1 = arguments[0];

            if (arguments.Length > 1)
                this.Argument2 = arguments[1];

            if (arguments.Length > 2)
                this.Argument3 = arguments[2];

            if (arguments.Length > 3)
                this.Argument4 = arguments[4];
        }

        [PacketField("sql", 0, DataTypes.String)]
        public string SqlText { get; private set; }

        [PacketField("arg1", 1, DataTypes.String)]
        public string Argument1 { get; private set; }

        [PacketField("arg2", 2, DataTypes.String)]
        public string Argument2 { get; private set; }

        [PacketField("arg3", 3, DataTypes.String)]
        public string Argument3 { get; private set; }

        [PacketField("arg4", 4, DataTypes.String)]
        public string Argument4 { get; private set; }

        [PacketField("control", 5, DataTypes.Int)]
        public int Control { get; set; }

        [PacketField("form", 6, DataTypes.Int)]
        public int Form { get; private set; }

        [PacketField("maxBufSize", 7, DataTypes.Int)]
        public int MaximumBufferSize { get; private set; }

    }
}
